package course.bigdecimal;

import java.math.BigDecimal;

public class MyBigDecimal {
    public static void main(String[] args) {
        BigDecimal b1 = new BigDecimal("0.1");
        BigDecimal b2 = new BigDecimal("0.3");

        BigDecimal add = b1.add(b2);
        System.out.println(add);

        BigDecimal subtract = b1.subtract(b2);
        System.out.println(subtract);

        BigDecimal multiply = b1.multiply(b2);
        System.out.println(multiply);

        BigDecimal divide = b1.divide(b2,5,BigDecimal.ROUND_UP);
        System.out.println(divide);

        BigDecimal divide2 = b1.divide(b2,5,BigDecimal.ROUND_FLOOR);
        System.out.println(divide2);

        BigDecimal divide3 = b1.divide(b2,5,BigDecimal.ROUND_HALF_DOWN);
        System.out.println(divide3);
    }
}
